

import org.antlr.runtime.Token;
import org.antlr.runtime.tree.CommonTreeAdaptor;

import com.sun.org.apache.bcel.internal.generic.NEW;

import ast.*;
import ast.terminais.*;


public class MyTreeAdaptor extends CommonTreeAdaptor {
	
	@Override
	public Object create(Token payload) {

		if (payload != null)
        {
			switch (payload.getType())
            {
            case gramaticaMM2Parser.PROGRAM:
			    return new Program(payload);
            case gramaticaMM2Parser.HEADER:
			    return new Header(payload);
            case gramaticaMM2Parser.DECLAR:
            	return new Declaracao(payload);
            case gramaticaMM2Parser.DECLAR_PROC:
			    return new Declaracao_procedimento(payload);
            case gramaticaMM2Parser.DECLAR_VAR:
			    return new Declaracao_variaveis(payload);
            case gramaticaMM2Parser.DECLAR_FUNC:
			    return new Declaracao_funcao(payload);
            case gramaticaMM2Parser.LIST_PARAM:
			    return new Lista_parametros(payload);
            case gramaticaMM2Parser.TIPO:
            	return new Tipo(payload);
            case gramaticaMM2Parser.LIST_VAR_ID:
			    return new List_Var_Id(payload);
            case gramaticaMM2Parser.LIST_VAR_ARRAY:
			    return new List_Var_Array(payload);
            case gramaticaMM2Parser.BODY:
			    return new Corpo(payload);
            case gramaticaMM2Parser.BODY_RETURN:
			    return new Corpo_return(payload);
            case gramaticaMM2Parser.ASSIGN_COMMAND_ID:
			    return new Assign_command_id(payload);
            case gramaticaMM2Parser.ASSIGN_COMMAND_ID_ARRAY:
			    return new Assign_command_id_array(payload);
            case gramaticaMM2Parser.CALL_COMMAND:
            	return new Call_command(payload);
            case gramaticaMM2Parser.IF_COMMAND:
			    return new If_Command(payload);
            case gramaticaMM2Parser.WHILE_COMMAND:
			    return new While_Command(payload);
            case gramaticaMM2Parser.FOR_COMMAND:
			    return new For_Command(payload);
            case gramaticaMM2Parser.CASE_COMMAND:
			    return new Case_Command(payload);
            case gramaticaMM2Parser.WRITEBOOL_COMMAND:
            	return new WriteBool_Command(payload);
            case gramaticaMM2Parser.WRITEINT_COMMAND:
			    return new WriteInt_Command(payload);
            case gramaticaMM2Parser.WRITECHAR_COMMAND:
			    return new WriteChar_Command(payload);
            case gramaticaMM2Parser.WRITELN:
			    return new Writeln(payload);
            case gramaticaMM2Parser.WRITESTRING_COMMAND:
			    return new WriteString(payload);
            case gramaticaMM2Parser.LIST_ARGS:
			    return new List_Args(payload);
            case gramaticaMM2Parser.LIST_NUMBER:
			    return new List_Number(payload);
            case gramaticaMM2Parser.LIST_NUMBER_RANGE:
			    return new List_Number_Range(payload);
            case gramaticaMM2Parser.EXPRESSION:
			    return new Expressao(payload);
            case gramaticaMM2Parser.CLAUSE:
			    return new Clause(payload);
            case gramaticaMM2Parser.LITERAL:
			    return new Literal(payload);
            case gramaticaMM2Parser.EQUAL_NEQUAL:
			    return new Equal_Nequal(payload);
            case gramaticaMM2Parser.ARITMETIC_EXPRESSION:
			    return new Aritmetic_Expression(payload);
            case gramaticaMM2Parser.TERM_EXPRESSION:
			    return new Termo(payload);
            case gramaticaMM2Parser.NOT_EXPRESSION:
			    return new Not_Expressao(payload);
            case gramaticaMM2Parser.MINUS_EXPRESSION:
			    return new Minus_Expression(payload);
			case gramaticaMM2Parser.INTEIRO:
			    return new Inteiro(payload);
			case gramaticaMM2Parser.BOOLEAN:
			    return new Inteiro(payload);
			case gramaticaMM2Parser.CHAR:
			    return new Inteiro(payload);
			case gramaticaMM2Parser.LETTER:
			    return new Letter(payload);
			case gramaticaMM2Parser.BOOL:
			    return new BOOL(payload);
			case gramaticaMM2Parser.DIGIT:
			    return new DIGIT(payload);
			case gramaticaMM2Parser.ID:
			    return new Identifier(payload);
			case gramaticaMM2Parser.ID_ARRAY:
			    return new Id_array(payload);
			case gramaticaMM2Parser.INT_POSITIVO:
			    return new IntPositivo(payload);
			  case gramaticaMM2Parser.TIPO_ARRAY:
				return new Tipo_array(payload);
			  case gramaticaMM2Parser.PEREN_EXP:
					return new Paren_Expression(payload);
		
            }
			
           
        }

        return super.create(payload);    	
	}
}
